<template>
  <div class="songList">
    <h1>新碟上架</h1>
    <el-carousel trigger="click" height="650px" :autoplay="false" indicator-position="outside">
      <el-carousel-item>
        <el-row :gutter="15" type="flex" class="myrow">
          <el-col :span="5" v-for="(item,i) in newDisc1" :key="i">
            <img :src="item.picUrl" alt="error" @click="toAlbumDetails(item.id)">
            <div class="listName" :title="item.name" @click="toAlbumDetails(item.id)">{{item.name}}</div>
            <div class="pbCount" @click="toSongerDetails(item.artist.id)">{{item.artist.name}}</div>
          </el-col>
        </el-row>
      </el-carousel-item>

      <el-carousel-item>
        <el-row :gutter="15" type="flex" class="myrow">
          <el-col :span="5" v-for="(item,i) in newDisc2" :key="i">
            <img :src="item.picUrl" alt="error" @click="toAlbumDetails(item.id)">
            <div class="listName" :title="item.name" @click="toAlbumDetails(item.id)">{{item.name}}</div>
            <div class="pbCount" @click="toSongerDetails(item.artist.id)">{{item.artist.name}}</div>
          </el-col>
        </el-row>
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<script>
export default {
  name: "NewDisc",
  props: ["newDisc1", "newDisc2"],
  methods: {
    toAlbumDetails(id) {
      this.$router.push({ name: "AlbumDetails", params: { id: id } });
    },
    toSongerDetails(id) {
      this.$router.push({ name: "SongerDetails", params: { id: id } });
      location.reload();
    },
  }
}
</script>

<style scoped>
img {
  width: 100%;
  height: 100%;
}
.listName {
  font-size: 1rem;
  width: 100%;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;
}
.listName:hover {
  color: RGB(64, 158, 255);
}
.pbCount {
  font-size: 1rem;
  width: 100%;
  color: RGB(153, 153, 153);
  margin-bottom: 20px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;
}
.pbCount:hover {
  color: RGB(64, 158, 255);
}
.songList {
  background: -webkit-linear-gradient(
    top,
    RGB(246, 246, 246),
    RGB(255, 255, 255)
  );
}
.songList h1 {
  text-align: center;
  padding-top: 30px;
}
.el-row {
  margin-bottom: 20px;
  padding: 20px;
}
.el-col {
  border-radius: 4px;
  margin: 0 12px 0 12px;
}
.row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}

.el-carousel__container {
  height: 100% !important;
}
.el-carousel__item:nth-child(2n) {
  background: -webkit-linear-gradient(
    top,
    RGB(246, 246, 246),
    RGB(255, 255, 255)
  );
}
.el-carousel__item:nth-child(2n + 1) {
  background: -webkit-linear-gradient(
    top,
    RGB(246, 246, 246),
    RGB(255, 255, 255)
  );
}
.myrow {
  flex: 1;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}
</style>